local skel = fk.CreateSkill {
  name = "emo__chaopin",
  tags = {Skill.Switch, Skill.Compulsory}
}

Fk:loadTranslationTable{
  ["emo__chaopin"] = "超频",
  [":emo__chaopin"] = "转换技，锁定技，阳：当你使用本回合第三张【杀】时，此【杀】不可响应且伤害+1（阳状态下，你的手牌上限和使用【杀】次数上限+2）；阴：结束阶段，你失去一点体力并摸等于体力上限张牌。",
}

skel:addEffect(fk.CardUsing, {
  anim_type = "switch",
  can_trigger = function(self, event, target, player, data)
    if player == target and player:hasSkill(skel.name) then
      if data.card.trueName == "slash" and player:getSwitchSkillState(skel.name) == fk.SwitchYang then
        local events = player.room.logic:getEventsOfScope(GameEvent.UseCard, 3, function (e)
          local use = e.data
          return use and use.from == player and use.card.trueName == "slash"
        end, Player.HistoryTurn)
        return #events == 3 and events[3].data == data
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.disresponsiveList = table.simpleClone(room.alive_players)
    data.additionalDamage = (data.additionalDamage or 0) + 1
  end,
})

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "switch",
  can_trigger = function(self, event, target, player, data)
    if player == target and player:hasSkill(skel.name) then
      return player:getSwitchSkillState(skel.name) == fk.SwitchYin and player.phase == Player.Finish
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:loseHp(player, 1, skel.name)
    if not player.dead then
      player:drawCards(player.maxHp, skel.name)
    end
  end,
})

skel:addEffect("targetmod", {
  residue_func = function(self, player, skill, scope, card)
    if skill and scope and skill.trueName == "slash_skill" and scope == Player.HistoryPhase
    and player:hasSkill(skel.name) and player:getSwitchSkillState("emo__chaopin") == fk.SwitchYang then
      return 2
    end
  end,
})

skel:addEffect("maxcards", {
  correct_func = function(self, player)
    if player:hasSkill(skel.name) and player:getSwitchSkillState("emo__chaopin") == fk.SwitchYang then
      return 2
    end
  end,
})

return skel
